home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1481.dms / var1481.adf / Scripts / bishops.mc < prev    next >
Text File  |  1994-07-07  |  10KB  |  453 lines

  1. ; This file Copyright 1994 Dan Wesnor
  2. ;
  3. ; This file may be freely distributed as long as no 
  4. ; information is changed, no charge is made for
  5. ; the file, and the archive in which the file was
  6. ; contained is distributed in tact.  Any violation 
  7. ; of these conditions requires written authorization 
  8. ; by the copyright holder.
  9.  
  10. /*
  11.     This is a script for the Magic Camera rendering system.
  12.     Magic Camera (MC) uses ray-tracing for realisting rendering
  13.     of shadows, reflections, and transparency.  It is in the
  14.     final phase of completion and should be released shortly.
  15.     Plans are for release as shareware with a nominal charge
  16.     for a full working version.
  17.  
  18.     See comments for a description of features.
  19.     Comments are either C-style (like this one), or a semi-colon
  20.     followed by text    ; like this.
  21. */
  22.  
  23. /*
  24.     Primitive objects include triangles and parallelograms,
  25.     both of which may be phong smoothed, spheres, rings (or disks),
  26.     and planes.
  27.  
  28.     Compound objects, which allow complex shapes to be built,
  29.     include extrusions, spins, skin-over-frame, filled complex
  30.     2-d polygons (with holes), heightfields, boxes, and
  31.     polygon spheres.
  32.  
  33.     Available patterns are check, wood, marble, brick,
  34.     several types of bitmap wraps, blotch, and clouds.
  35.  
  36.     Textures include waves and several type of bumpmaps.
  37.  
  38.     Lamps include point-source, directional, directional 
  39.     spotlights (w/ beam width and beam falloff sharpness
  40.     controls), or spherical extended.
  41.  
  42.     Variables, which may be used in complex expressions, include
  43.     real numbers, integers, 3d-vectors, and arrays of reals, 2-d vectors,
  44.     and 3-d vectors.  Variables and arrays may be used to facilitate
  45.     animation.
  46. */
  47.  
  48.  
  49.  
  50. maxoctdepth 5    ; controls for the octree, which
  51. maxobcube 2    ; is an adaptive automatic object bounding
  52.         ; mechanism
  53.  
  54. maxaadepth 2    ; set the maximum number of pixel splits
  55.         ; for adaptive anti-aliasing
  56.  
  57. ; a couple of variables to set the board size
  58. real boardsize = 64
  59. real squaresize = boardsize/8
  60.  
  61.  
  62. camera {    ; set up the camera
  63.     loc    <60, 30, 140>    ; location
  64.     target    <3.5*squaresize, 6, 4*squaresize>    ; point at
  65.     res     640 480        ; image resolution
  66.     aspect     1.0        ; pixel aspect
  67.     hfov    45        ; horizontal field of view
  68. }
  69.  
  70.  
  71. lamp {
  72.     direct    <.25, -1.75, -1>    ; a directional (non-
  73.                     ; point source) lamp
  74.     color    <0.5, 0.5, 0.5>        ; the lamp color in RGB
  75. }
  76.  
  77. lamp {
  78.     direct    <-1, -.75, -1>    ; another directional lamp
  79.     color    <0.5, 0.5, 0.5>
  80. }
  81.  
  82. include "scripts/bishop.obj"    ; include file which contains
  83.                     ; bishop.obj
  84.  
  85. /* this little manipulation assures us that we have a bishop
  86.    which will fit on a square of the chessboard
  87. */
  88.  
  89. object mybishop.obj
  90. real bishop_scale = squaresize/(2*bishop_radius)
  91. scale bishop.obj <bishop_scale, bishop_scale, bishop_scale>
  92. instance bishop.obj
  93. endobject
  94.  
  95. /* facetted */
  96.  
  97. color red {    ; build a 'color' type pattern called 'red'
  98.     diff    <1, 0, 0>    ; diffuse color in RGB
  99.     scoef    50        ; specular coefficient
  100.                 ; (hot spot tightness)
  101.     srefl    1        ; specular reflection
  102.                 ; (hot spot brightness)
  103. }
  104.  
  105. translate mybishop.obj <3.5*squaresize, 0, 3.5*squaresize>    
  106.                     ; put the bishop in position
  107. instance {                ; drop it into the scene
  108.     object    mybishop.obj
  109.     subpatt    __bishopsurf    red    ; substitute the pattern 'red'
  110.                     ; for the pattern '__bishopsurf',
  111.                     ; effectively changing the object's
  112.                     ; color
  113. }
  114. reset mybishop.obj    ; reset the bishop's transformation matrix
  115.  
  116. translate mybishop.obj <3.5*squaresize, 0, 5.5*squaresize>
  117. instance {
  118.     object    mybishop.obj
  119.     subpatt    __bishopsurf    red
  120. }
  121. reset mybishop.obj
  122.  
  123. /* checked */
  124.  
  125. color blue {    ; another simple 'color' pattern
  126.     diff    <0, 0, 1>
  127.     scoef    50
  128.     srefl    1
  129. }
  130.  
  131. color white {    ; another simple 'color' pattern
  132.     diff    <1, 1, 1>
  133.     scoef    50
  134.     srefl    1
  135. }
  136.  
  137. check blue_white {    ; a checkerboard pattern called 'blue_white'
  138.     patt1    blue    ; uses, you guessed it, 'blue'
  139.     patt2    white    ; and 'white'
  140.     xsize    .75    ; the checks are 0.75 units 
  141.     ysize    .75    ; square
  142.     zsize    .75
  143. }
  144.  
  145. /*
  146.     translate and create a blue-white checked bishop
  147. */
  148.  
  149. translate mybishop.obj <6.5*squaresize, 0, 4.5*squaresize>    
  150. instance {
  151.     object    mybishop.obj
  152.     subpatt    __bishopsurf    blue_white
  153. }
  154. reset mybishop.obj
  155.  
  156. /* brick */
  157.  
  158. color brick_red {    ; new 'color' pattern
  159.     diff    <.8, 0, 0>
  160. }
  161.  
  162. color mortar_white {    ; new 'color' pattern
  163.     diff    <.8, .8, .8>
  164. }
  165.  
  166. brick brick1 {        ; a brick pattern
  167.     mortar    mortar_white    ; pattern for 'mortar'
  168.     brick    brick_red    ; pattern for brick
  169.     xsize    .9        ; dimensions of the bricks
  170.     ysize    .45
  171.     zsize    .45
  172.     msize    .1    ; thickness of the mortar
  173.     yoffset .4    ; offset each (y dimension) row
  174.             ; of bricks 0.4 units in X
  175.     zoffset 0    ; don't offset any z-dimension
  176.             ; row of bricks
  177. }
  178.  
  179. ; move the object into position and instance it with the brick pattern
  180.  
  181. translate mybishop.obj <5.5*squaresize, 0, 5.5*squaresize>
  182. instance {
  183.     object    mybishop.obj
  184.     subpatt    __bishopsurf    brick1
  185. }
  186. reset mybishop.obj
  187.  
  188. /* glass */
  189.  
  190. color glass {    ; another simple 'color' pattern, but this
  191.         ; one will be transparent
  192.     diff    <0, 0, 0>    ; to be completely clear, we don't
  193.                 ; add any diffuse color
  194.     refl    <.1, .1, .1>    ; glass IS slightly reflective
  195.     trans    <.9, .9, .9>    ; the glass transmits 90% of all
  196.                 ; RGB color
  197.     filt    <.01, .01, .01>    ; this controls how much color
  198.                 ; the glass doesn't transmit per
  199.                 ; unit length, i.e., how much
  200.                 ; light is filtered by the glass
  201.     scoef    50    ; specular hot spot numbers
  202.     srefl    1
  203.     index    1.67    ; the glass's index of refraction
  204. }
  205.  
  206. ; position it and drop it into the scene with the new pattern
  207.  
  208. translate mybishop.obj <4.5*squaresize, 0, 6.5*squaresize>
  209. instance {
  210.     object    mybishop.obj
  211.     subpatt    __bishopsurf    glass
  212. }
  213. reset mybishop.obj
  214.  
  215. /* mirror */
  216.  
  217. color mirror {    ; create a reflective 'color'
  218.     diff    <0, 0, 0>    ; if diff was not <0,0,0>, the mirror
  219.                 ; would appear tinted
  220.     refl    <.9, .9, .9>    ; 90% of light is reflected
  221.     scoef    50        ; specular reflection numbers
  222.     srefl    1
  223. }
  224.  
  225. ; movie it, drop it with new pattern
  226.  
  227. translate mybishop.obj <2.5*squaresize, 0, 4.5*squaresize>
  228. instance {
  229.     object    mybishop.obj
  230.     subpatt    __bishopsurf    mirror
  231. }
  232. reset mybishop.obj
  233.  
  234. /* wooden */
  235.  
  236. color light_brown {    /* new 'color' for wood */
  237.     diff    <0.7, 0.5, 0.0>
  238. }
  239.  
  240. color dark_brown {    /* new 'color' for wood */
  241.     diff    <0.3, 0.1, 0.0>
  242. }
  243.  
  244. wood light_wood {    ; a wood pattern
  245.     patt    light_brown    ; the meat of the wood
  246.     grain    dark_brown    ; the pattern to use for the grain
  247.     scale    10        ; scale the pattern so it appears
  248.                 ; the right size
  249. }
  250.  
  251. ; move it, drop it
  252.  
  253. translate mybishop.obj <2.5*squaresize, 0, 6.5*squaresize>
  254. instance {
  255.     object    mybishop.obj
  256.     subpatt    __bishopsurf    light_wood
  257. }
  258. reset mybishop.obj
  259.  
  260. /* blotch */
  261.  
  262. ; new colors
  263.  
  264. color a_red { diff <1, 0, 0> }
  265. color a_blue { diff <0, 0, 1> }
  266. color a_green { diff <0, 1, 0> }
  267. color a_yellow { diff <1, 1, 0> }
  268. color a_white { diff <1, 1, 1> }
  269.  
  270. blotch asvpt {            ; create a blotch pattern
  271.     patt    a_red        ; a blotch is basically
  272.     patt    a_blue        ; a mildly interesting blend
  273.     patt    a_white        ; of several colors
  274.     patt    a_green
  275.     patt    a_yellow
  276.     scale    3
  277. }
  278.  
  279. ; move it, drop it
  280.  
  281. translate mybishop.obj <6.5*squaresize, 0, 6.5*squaresize>
  282. instance {
  283.     object    mybishop.obj
  284.     subpatt    __bishopsurf    asvpt
  285. }
  286. reset mybishop.obj
  287.  
  288. /* cloudy */
  289.  
  290. ; colors for clouds
  291.  
  292. color cl_white {
  293.     diff    <1, 1, 1>
  294. }
  295.  
  296. color cl_blue    {
  297.     diff    <.3, .3, 1>
  298. }
  299.  
  300. clouds cloudy {
  301.     clouds    cl_white    ; the clouds are white on a
  302.     sky    cl_blue        ; blue sky
  303.     scale    .5        ; set the size
  304.             ; the apparent turbulence of the
  305.             ; clouds is also controllable
  306. }
  307.  
  308. ; place the object
  309.  
  310. translate mybishop.obj <1.5*squaresize, 0, 5.5*squaresize>
  311. instance {
  312.     object    mybishop.obj
  313.     subpatt    __bishopsurf    cloudy
  314. }
  315. reset mybishop.obj
  316.  
  317. /* marble */
  318.  
  319. ; color for marble
  320.  
  321. color ma_grain {
  322.     diff    <.3, .2, 0>
  323. }
  324.  
  325. color ma_white {
  326.     diff    <.9, .8, .5>
  327. }
  328.  
  329. marble marb {
  330.     patt    ma_white    ; once again, this is the 'meat'
  331.     grain    ma_grain    ; and the grain of the marble
  332.     scale    3        ; size it
  333.     pow    .75        ; control the sharpness between the
  334.                 ; meat and the grain
  335. }
  336.  
  337. ; place the object
  338.  
  339. translate mybishop.obj <1.5*squaresize, 0, 3.5*squaresize>
  340. instance {
  341.     object    mybishop.obj
  342.     subpatt    __bishopsurf    marb
  343. }
  344. reset mybishop.obj
  345.  
  346. /* waves */
  347.  
  348. color wa_yellow {
  349.     diff    <1, 1, 0>
  350. }
  351.  
  352. waves wavy {
  353.     scale    1.2    ; set the size of the texture,
  354.             ; also the apparent height and
  355.             ; complexity could have been changed
  356. }
  357.  
  358. ; notice that NULLTEXT is the name used when substituting for
  359. ; a texture that does not exist
  360.  
  361. translate mybishop.obj <4.5*squaresize, 0, 4.5*squaresize>
  362. instance {
  363.     object    mybishop.obj
  364.     subpatt    __bishopsurf    wa_yellow
  365.     subtext    NULLTEXT    wavy
  366. }
  367. reset mybishop.obj
  368.  
  369. /* texture wrapped */
  370.  
  371. iff "mapfiles/tartan.iff" wrap.map    ; load the iff file
  372.                     ; and name it wrap.map
  373.  
  374. wrapcy wrappatt {
  375.     bitmap    wrap.map    ; use 'wrap.map'
  376.     patt    red        ; characteristics like
  377.                 ; reflectivity and trasparency
  378.                 ; will be pulled from the pattern
  379.                 ; called 'red'
  380.     height    bishop_height*bishop_scale/6
  381.                 ; the height of the cylinder used
  382.                 ; as an intermediate surface by the wrap
  383.     xrep    4        ; wrap the bitmap around the cylinder once
  384.     filter    1        ; turn off pre-filtering of the image
  385.     dodiff            ; the bitmap will be used to modulate
  386.                 ; the diffuse color of the object.
  387.                 ; it could also modulate reflection
  388.                 ; and transmission
  389. }
  390.  
  391. ; place the object
  392.  
  393. translate mybishop.obj <5.5*squaresize, 0, 3.5*squaresize>
  394. instance {
  395.     object    mybishop.obj
  396.     subpatt    __bishopsurf    wrappatt
  397. }
  398. reset mybishop.obj
  399.  
  400. /* the checkerboard */
  401.  
  402. /* the chess pieces will be placed on a checkerboard made
  403.    of squares of alternating mirrors and reflective marble
  404. */
  405.  
  406. color mirror_black {
  407.     diff    <0, 0, 0>
  408.     refl    <.55, .55, .55>
  409.     scoef    50
  410.     srefl    1
  411. }
  412.  
  413.  
  414. color mirror_white {
  415.     diff    <.75, .75, .75>
  416.     refl    <.25, .25, .25>
  417.     scoef    50
  418.     srefl    1
  419. }
  420.  
  421. marble black_marble {
  422.     patt    mirror_black
  423.     grain    mirror_white
  424.     scale    .075
  425.     pow    .75
  426. }
  427.  
  428. marble white_marble {
  429.     patt    mirror_white
  430.     grain    mirror_black
  431.     scale    .6
  432.     pow    .75
  433. }
  434.  
  435. check checker {
  436.     patt1    white_marble
  437.     patt2    mirror_black
  438.     xsize    8
  439.     zsize    8
  440.     ysize    1
  441. }
  442.  
  443. /* this box is the checker board itself */
  444.  
  445. box {
  446.     loc    <0, 0, 0>
  447.     v1    <boardsize, 0, 0>
  448.     v2    <0, -boardsize/32, 0>
  449.     v3    <0, 0, boardsize>
  450.     patt    checker
  451. }
  452.  
  453.